"""
Tensor的创建
"""
import torch
import numpy as np

# a = torch.Tensor([[1, 2], [3, 4]])
# print(a)
# print(a.type())
# print(a.shape)

# a = torch.Tensor(2, 3)
# print(a)
# print(a.shape)

# a = torch.ones(2, 2)
# print(a)

# 对角线是1
# a = torch.eye(2, 2)
# print(a)

# a = torch.zeros(2, 2)
# print(a)

# a = torch.Tensor(3, 4)
# b = torch.zeros_like(a)
# c = torch.ones_like(a)
# print(b)
# print(c)

# 随机生成 [0, 1)
# a = torch.rand(3, 5)
# print(a)

# a = torch.normal(mean=0.0, std=torch.rand(2, 3))
# print(a)
# a = torch.normal(mean=torch.rand(5), std=torch.rand(5))
# print(a)

# 均匀分布
# a = torch.Tensor(2, 2).uniform_(-1, 1)
# print(a)

# 序列
# a = torch.arange(0, 11, 2)
# print(a)

# 等间隔
# a = torch.linspace(2, 10, 4)
# print(a)

# 随机打乱
# a = torch.randperm(10)
# print(a)

# a = np.array([[1, 2], [3, 4]])
# print(a)


